From 6b9ac1043b267636b0b4d77e0538923772dfacff Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 10 Apr 2020 23:59:21 -0400 Subject: [PATCH] Document actions --- gtk/gtkcoloreditor.c | 9 +++-- gtk/gtkcolorswatch.c | 5 +++ gtk/gtklabel.c | 5 +++ gtk/gtklinkbutton.c | 10 +++++ gtk/gtknotebook.c | 5 +++ gtk/gtkplacesview.c | 41 ++++++++++++++++++++ gtk/gtktext.c | 89 ++++++++++++++++++++++++++++++++++++-------- gtk/gtktextview.c | 82 +++++++++++++++++++++++++++++++++------- gtk/gtkwindow.c | 5 +++ 9 files changed, 219 insertions(+), 32 deletions(-) diff --git a/gtk/gtkcoloreditor.c b/gtk/gtkcoloreditor.c index 694557eabe..66c2c49e4a 100644 --- a/gtk/gtkcoloreditor.c +++ b/gtk/gtkcoloreditor.c @@ -561,10 +561,13 @@ gtk_color_editor_class_init (GtkColorEditorClass *class) gtk_widget_class_bind_template_callback (widget_class, entry_focus_changed); gtk_widget_class_bind_template_callback (widget_class, pick_color); + /** + * GtkColorEditor|color.edit: + * @component: the component to edit, "h", "sv" or "a" + * + * Opens the edit popup for one of the color components. + */ gtk_widget_class_install_action (widget_class, "color.edit", "s", popup_edit); - gtk_widget_class_install_action (widget_class, "color.edit", "s", popup_edit); - gtk_widget_class_install_action (widget_class, "color.edit", "s", popup_edit); - } static void diff --git a/gtk/gtkcolorswatch.c b/gtk/gtkcolorswatch.c index 72d66192cc..5660b52b4c 100644 --- a/gtk/gtkcolorswatch.c +++ b/gtk/gtkcolorswatch.c @@ -497,6 +497,11 @@ gtk_color_swatch_class_init (GtkColorSwatchClass *class) g_param_spec_boolean ("can-drop", P_("Can Drop"), P_("Whether the swatch should accept drops"), FALSE, GTK_PARAM_READWRITE)); + /** + * GtkColorSwatch|menu.popup: + * + * Opens the context menu. + */ gtk_widget_class_install_action (widget_class, "menu.popup", NULL, swatch_popup_menu); gtk_widget_class_add_binding_action (widget_class, diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 1006756743..f930b2de73 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -1023,6 +1023,11 @@ gtk_label_class_init (GtkLabelClass *class) g_object_class_install_properties (gobject_class, NUM_PROPERTIES, label_props); + /** + * GtkLabel|menu.popup: + * + * Opens the context menu. + */ gtk_widget_class_install_action (widget_class, "menu.popup", NULL, gtk_label_popup_menu); /* diff --git a/gtk/gtklinkbutton.c b/gtk/gtklinkbutton.c index 96831ec083..b99ae2a0d4 100644 --- a/gtk/gtklinkbutton.c +++ b/gtk/gtklinkbutton.c @@ -228,9 +228,19 @@ gtk_link_button_class_init (GtkLinkButtonClass *klass) gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_LINK_BUTTON_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("button")); + /** + * GtkLinkButton|clipboard.copy: + * + * Copies the url to the clipboard. + */ gtk_widget_class_install_action (widget_class, "clipboard.copy", NULL, gtk_link_button_activate_clipboard_copy); + /** + * GtkLinkButton|menu.popup: + * + * Opens the context menu. + */ gtk_widget_class_install_action (widget_class, "menu.popup", NULL, gtk_link_button_popup_menu); gtk_widget_class_add_binding_action (widget_class, diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 36a651d23c..3edb540074 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -1304,6 +1304,11 @@ gtk_notebook_class_init (GtkNotebookClass *class) G_TYPE_FROM_CLASS (gobject_class), _gtk_marshal_OBJECT__OBJECTv); + /** + * GtkNotebook|menu.popup: + * + * Opens the context menu. + */ gtk_widget_class_install_action (widget_class, "menu.popup", NULL, gtk_notebook_popup_menu); gtk_widget_class_add_binding_signal (widget_class, diff --git a/gtk/gtkplacesview.c b/gtk/gtkplacesview.c index 61938f345c..415358486f 100644 --- a/gtk/gtkplacesview.c +++ b/gtk/gtkplacesview.c @@ -2330,12 +2330,53 @@ gtk_places_view_class_init (GtkPlacesViewClass *klass) gtk_widget_class_bind_template_callback (widget_class, on_listbox_row_activated); gtk_widget_class_bind_template_callback (widget_class, on_recent_servers_listbox_row_activated); + /** + * GtkPlacesView|location.open: + * + * Opens the location in the current window. + */ gtk_widget_class_install_action (widget_class, "location.open", NULL, open_cb); + + /** + * GtkPlacesView|location.open-tab: + * + * Opens the location in a new tab. + */ gtk_widget_class_install_action (widget_class, "location.open-tab", NULL, open_cb); + + /** + * GtkPlacesView|location.open-window: + * + * Opens the location in a new window. + */ gtk_widget_class_install_action (widget_class, "location.open-window", NULL, open_cb); + + /** + * GtkPlacesView|location.mount: + * + * Mount the location. + */ gtk_widget_class_install_action (widget_class, "location.mount", NULL, mount_cb); + + /** + * GtkPlacesView|location.connect: + * + * Connect the location. + */ gtk_widget_class_install_action (widget_class, "location.connect", NULL, mount_cb); + + /** + * GtkPlacesView|location.unmount: + * + * Unmount the location. + */ gtk_widget_class_install_action (widget_class, "location.unmount", NULL, unmount_cb); + + /** + * GtkPlacesView|location.disconnect: + * + * Disconnect the location. + */ gtk_widget_class_install_action (widget_class, "location.disconnect", NULL, unmount_cb); gtk_widget_class_set_css_name (widget_class, I_("placesview")); diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 7908e31119..1d56e7ea1f 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -1194,9 +1194,82 @@ gtk_text_class_init (GtkTextClass *class) NULL, NULL, NULL, G_TYPE_NONE, 0); + + /* + * Actions + */ + + /** + * GtkText|clipboard.cut: + * + * Copies the contents to the clipboard and deletes it from the widget. + */ + gtk_widget_class_install_action (widget_class, "clipboard.cut", NULL, + gtk_text_activate_clipboard_cut); + + /** + * GtkText|clipboard.copy: + * + * Copies the contents to the clipboard. + */ + gtk_widget_class_install_action (widget_class, "clipboard.copy", NULL, + gtk_text_activate_clipboard_copy); + + /** + * GtkText|clipboard.copy: + * + * Inserts the contents of the clipboard into the widget. + */ + gtk_widget_class_install_action (widget_class, "clipboard.paste", NULL, + gtk_text_activate_clipboard_paste); + + /** + * GtkText|selection.delete: + * + * Deletes the current selection. + */ + gtk_widget_class_install_action (widget_class, "selection.delete", NULL, + gtk_text_activate_selection_delete); + + /** + * GtkText|selection.select-all: + * + * Selects all of the widgets content. + */ + gtk_widget_class_install_action (widget_class, "selection.select-all", NULL, + gtk_text_activate_selection_select_all); + + /** + * GtkText|misc.insert-emoji: + * + * Opens the Emoji chooser. + */ + gtk_widget_class_install_action (widget_class, "misc.insert-emoji", NULL, + gtk_text_activate_misc_insert_emoji); + + gtk_widget_class_install_property_action (widget_class, + "misc.toggle-visibility", + "visibility"); + /** + * GtkText|text.undo: + * + * Undoes the last change to the contents. + */ gtk_widget_class_install_action (widget_class, "text.undo", NULL, gtk_text_real_undo); + + /** + * GtkText|text.redo: + * + * Redoes the last change to the contents. + */ gtk_widget_class_install_action (widget_class, "text.redo", NULL, gtk_text_real_redo); + + /** + * GtkText|menu.popup: + * + * Opens the context menu. + */ gtk_widget_class_install_action (widget_class, "menu.popup", NULL, gtk_text_popup_menu); /* @@ -1411,22 +1484,6 @@ gtk_text_class_init (GtkTextClass *class) gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_TEXT_ACCESSIBLE); gtk_widget_class_set_css_name (widget_class, I_("text")); - - gtk_widget_class_install_action (widget_class, "clipboard.cut", NULL, - gtk_text_activate_clipboard_cut); - gtk_widget_class_install_action (widget_class, "clipboard.copy", NULL, - gtk_text_activate_clipboard_copy); - gtk_widget_class_install_action (widget_class, "clipboard.paste", NULL, - gtk_text_activate_clipboard_paste); - gtk_widget_class_install_action (widget_class, "selection.delete", NULL, - gtk_text_activate_selection_delete); - gtk_widget_class_install_action (widget_class, "selection.select-all", NULL, - gtk_text_activate_selection_select_all); - gtk_widget_class_install_action (widget_class, "misc.insert-emoji", NULL, - gtk_text_activate_misc_insert_emoji); - gtk_widget_class_install_property_action (widget_class, - "misc.toggle-visibility", - "visibility"); } static void diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index a7d8c5504c..261e46b68e 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -1464,8 +1464,77 @@ gtk_text_view_class_init (GtkTextViewClass *klass) NULL, G_TYPE_NONE, 0); + /* + * Actions + */ + + /** + * GtkTextView|clipboard.cut: + * + * Copies the contents to the clipboard and deletes it from the widget. + */ + gtk_widget_class_install_action (widget_class, "clipboard.cut", NULL, + gtk_text_view_activate_clipboard_cut); + + /** + * GtkTextView|clipboard.copy: + * + * Copies the contents to the clipboard. + */ + gtk_widget_class_install_action (widget_class, "clipboard.copy", NULL, + gtk_text_view_activate_clipboard_copy); + + /** + * GtkTextView|clipboard.paste: + * + * Inserts the contents of the clipboard into the widget. + */ + gtk_widget_class_install_action (widget_class, "clipboard.paste", NULL, + gtk_text_view_activate_clipboard_paste); + + /** + * GtkTextView|selection.delete: + * + * Deletes the current selection. + */ + gtk_widget_class_install_action (widget_class, "selection.delete", NULL, + gtk_text_view_activate_selection_delete); + + /** + * GtkTextView|selection.select-all: + * + * Selects all of the widgets content. + */ + gtk_widget_class_install_action (widget_class, "selection.select-all", NULL, + gtk_text_view_activate_selection_select_all); + + /** + * GtkTextView|misc.insert-emoji: + * + * Opens the Emoji chooser. + */ + gtk_widget_class_install_action (widget_class, "misc.insert-emoji", NULL, + gtk_text_view_activate_misc_insert_emoji); + + /** + * GtkTextView|text.undo: + * + * Undoes the last change to the contents. + */ gtk_widget_class_install_action (widget_class, "text.undo", NULL, gtk_text_view_real_undo); + + /** + * GtkTextView|text.redo: + * + * Redoes the last change to the contents. + */ gtk_widget_class_install_action (widget_class, "text.redo", NULL, gtk_text_view_real_redo); + + /** + * GtkTextView|menu.popup: + * + * Opens the context menu. + */ gtk_widget_class_install_action (widget_class, "menu.popup", NULL, gtk_text_view_popup_menu); /* @@ -1755,19 +1824,6 @@ gtk_text_view_class_init (GtkTextViewClass *klass) quark_text_selection_data = g_quark_from_static_string ("gtk-text-view-text-selection-data"); quark_gtk_signal = g_quark_from_static_string ("gtk-signal"); quark_text_view_child = g_quark_from_static_string ("gtk-text-view-child"); - - gtk_widget_class_install_action (widget_class, "clipboard.cut", NULL, - gtk_text_view_activate_clipboard_cut); - gtk_widget_class_install_action (widget_class, "clipboard.copy", NULL, - gtk_text_view_activate_clipboard_copy); - gtk_widget_class_install_action (widget_class, "clipboard.paste", NULL, - gtk_text_view_activate_clipboard_paste); - gtk_widget_class_install_action (widget_class, "selection.delete", NULL, - gtk_text_view_activate_selection_delete); - gtk_widget_class_install_action (widget_class, "selection.select-all", NULL, - gtk_text_view_activate_selection_select_all); - gtk_widget_class_install_action (widget_class, "misc.insert-emoji", NULL, - gtk_text_view_activate_misc_insert_emoji); } static void diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 8ae11e6681..59cf8d94c3 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -1057,6 +1057,11 @@ gtk_window_class_init (GtkWindowClass *klass) * Key bindings */ + /** + * GtkWindow|default.activate: + * + * Activate the default widget. + */ gtk_widget_class_install_action (widget_class, "default.activate", NULL, gtk_window_activate_default_activate); -- 2.30.2